/*
 * 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙，邂逅框架梦，本文采用木兰宽松许可证第2版]
 * 
 * https://zhiqim.org/project/zhiqim_kit/zhiqim_git.htm
 *
 * ZhiqimGit is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *          http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */
package org.zhiqim.git.refer;

/**
 * 引用更新器执行后的状态枚举值
 *
 * @version v1.0.0 @author zouzhigang 2017-4-12 新建与整理
 */
public enum RefUpdateResult
{
    /** 未处理 */
    NOT_ATTEMPTED,

    /** 锁定失败 */
    LOCK_FAILURE,
    
    /** 引用未修改 */
    NO_CHANGE,

    /** 新增 */
    NEW,

    /** 强制更新或删除，不处理合并 */
    FORCED,

    /** 快进，使用历史记录处理 */
    FAST_FORWARD,

    /** 拒绝，非快进且没找到 */
    REJECTED,

    /** 拒绝删除当前分枝 */
    REJECTED_CURRENT_BRANCH,
    
    /** IO异常 */
    IO_FAILURE,

    /** 重命名 */
    RENAMED;
    
    /**
     * 引用更新结果转为字符串
     * 
     * @param status    引用更新结果
     * @return          字符串
     */
    public static String toResultString(final RefUpdateResult status)
    {
        switch (status)
        {
        case FORCED:
            return "forced-update";
        case FAST_FORWARD:
            return "fast forward";
        case NEW:
            return "created";
        default:
            return null;
        }
    }
}